<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script>
function getimages(id)
{
	$.post("/magento/ajaxbutton", {"op": "getimages","id":id},
	  function(data){
		  if(data)
		  {
				$("#newtip_info"+id).html("<img src="+data.small_image+">");  
			}
	   },"json");
}
function closenettip(id)
{
	$("#newtip_info"+id).html('');
}

function batchchangData()
{
	var html="";
	 var str = selectallpro();
	  if (str != false) {
		$.post("/magento/ajaxbutton", {"op": "shopifygetonegoods","id":str},
		  function(data){ 
				/*  for (var j = 0; j < data.length; j++) {
				html+="<tr>";
				html+="<td>&nbsp;&nbsp;&nbsp;"+data[j].webname+"</td><td><input name=\"sku[]\" id=orderid"+data[j].sku+" placeholder=\"商品编号\" class=\"width100\" type=\"text\" value="+data[j].sku+"></td><td><input name=\"name[]\" placeholder=\"名称\" id=\"name\" value=\""+data[j].name+"\" type=\"text\"  class=\"width150\"></td><td><input name=\"weight[]\" id=\"weight\"  value="+data[j].weight+" class=\"selection\" style=\"width:30px;\"></td><td><input name=\"price[]\" id=\"price\"  value="+data[j].price+"  style=\"width:50px;\">"+data[j].currency+"</td><td><input name=\"special_price[]\" id=\"special_price\"  value="+data[j].special_price+"  style=\"width:50px;\">"+data[j].currency+"</td><td><input name=\"description[]\" id=\"description\"  value=\""+data[j].description+"\"  style=\"width:100px;\"></td><td><input name=\"short_description[]\" id=\"short_description\"  value=\""+data[j].short_description+" \" style=\"width:100px;\"></td><td><input name=\"meta_title[]\" id=\"meta_title\"  value=\""+data[j].meta_title+"\"  style=\"width:80px;\"></td><td><input name=\"meta_keywords[]\" id=\"meta_keywords\"  value=\""+data[j].meta_keywords+"\"  style=\"width:80px;\"></td><td><input name=\"including[]\" id=\"including\"  value=\""+data[j].including+"\"  style=\"width:80px;\"></td><td><input name=\"fabric[]\" id=\"fabric\"  value=\""+data[j].fabric+"\"  style=\"width:80px;\"></td><td><select name=\"is_open[]\" id=\"is_open\" class=\"selection\" style=\"width:80px;\">    <option value=\"0\" >正常销售</option> <option value=\"1\">商品停售</option> </select></td>";
						
			   html+="</tr>";
				
						
					}*/
				$("#endorderlistst").html(data);
				$('#endorderform').modal('show');	
			
		   },"text");
	 }
			
}

function AWSsubmitst(f,t)
{
	$('#'+t).modal('hide');
	AWS.ajax_post($('#'+f));
}

function magentocsv(){
  $('#magentocsv').modal('show');
}

function magentocsvok(){
 var magentowebname = $("#magentowebname").val();
 if(magentowebname == ''){
   alert("请选择需要导出的网站！");
   return;
 }
 var url='/exportorder/ajaxbutton?op=magento_v1_shopify&webname='+magentowebname;

 window.open(url,'','height=500,width=611,scrollbars=yes,status=yes');

}

</script>

<title>网站在线商品列表</title>
<body class="withvernav">
<div class="bodywrapper">
{{include file='/public/orderleft.tpl'}}
<div class="centercontent">
  <div class="pageheader notab">
    <h1 class="pagetitle">网站在线商品列表</h1>
    <span class="pagedesc"><br></span>
    <div class="menulist">
    <ul class="profile_summary">
       <li class="current"> <a href="javascript:void(0)" onClick="magentocsv()"><span>在线产品转shopify</span></a></li>
       <li class="current"><a href="/magento/shopifyaddnewproduct" class=""><span>添加新的商品</span></a></li>
        </ul>
  </div>
  </div>
  <!--pageheader-->
  <div id="contentwrapper" class="contentwrapper">
    <div id="basicform" class="subcontent"> 
      <!--搜索栏-->
     <div style="float:left">
     <div style="padding:3px">
       <a href="/magento/ajaxbutton?op=updateshopifywebdata"  class="stdbtn btn_blue"><span>批量更新数据</span></a>
        <a href="javascript:void(0)" onClick="batchchangData()" class="stdbtn btn_red"><span>批量修改信息</span></a>
        </div>
      </div>
      <div style="clear: both"></div>
      <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
    </div>
    <form class="stdform stdform2" method="get" id="search" action="/magento/shopifyproductlist">
      <div class="tableoptions">
       
      
        <select name="webname">
              <option value="">-店铺名-</option>
              {{foreach from=$webname item=li key=key}}
                <option value="{{$li.webname}}" {{if $webnamevalue==$li.webname}} selected{{/if}}>
                    {{$li.webname}}
                </option>
              {{/foreach}}
          </select>
       
        
      
       
       操作时间
        <input type="text"  name="starttime" value="{{$starttime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" />
        -
        <input type="text"  name="endtime" value="{{$endtime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" />
      关键词
        :
        <input type="text" name="kw" id="kw" class="width200" value="{{$kw}}" placeholder="关键词" />
        &nbsp;
        <button class="btn btn-primary" id="searchbtn">Search</button>
        <input type='hidden' name='if_csv' id='if_csv'>
        <input type='hidden' name='isow' id='isow'>
        <input type='hidden' name='isno' id='isno'>
        <input type='hidden' name='que' id='que'>
      </div>
    </form>
    <!--搜索栏结束-->
    <table cellpadding="0" cellspacing="0" border="0" class="stdtable" style="table-layout: fixed;">
      <thead>
        <tr class="lbbt">
          <td width="3%"  bgcolor="#FEFFF1"><a onClick="allSelect('ppid[]')">全选</a></td>
          <td  bgcolor="#FEFFF1">店铺</td>
          <td bgcolor="#FEFFF1">商品编号</td>
          <td width="25%"  bgcolor="#FEFFF1">商品名称</td>
          <td  bgcolor="#FEFFF1">价格</td>
          <td  bgcolor="#FEFFF1"  width="5%" >折扣价</td>
          <td  bgcolor="#FEFFF1"  width="6%" >重量（千克）</td>
          <td  bgcolor="#FEFFF1">包含物品</td>
           <td bgcolor="#FEFFF1">质地</td>
          <td  width="6%" bgcolor="#FEFFF1" >状态</td>
         <td   bgcolor="#FEFFF1" >查看</td>
        </tr>
      </thead>
      <tbody >
      
      {{foreach from=$productlist item=li key=key}}
      <tr>
        <td ><input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$li.id}}" /></td>
        <td valign="middle" style="position:relative;">{{$li.webname}}</td>
        <td valign="middle" style="position:relative;"><a href="/product/productlist?other={{$li.sku}}" target="_blank"><font color="#6666FF">{{$li.sku}}</font></a>
        {{if $li.variant_name}}
        <br>{{$li.variant_name}}
        {{/if}}
        </td>
       
        <td valign="middle" style="width: 150px; overflow:hidden;white-space:nowrap; text-overflow:ellipsis;"> 
       {{if $li.base_image}}
       		<a href="{{$li.base_image}}" target="_blank"><img src="/fuman/images/picture0.png"></a>
       {{/if}}
       <a href="javascript:void(0)">{{$li.name}} <span id="tip_info" style="width:100%">{{$li.name}} </span></a>
       
        
       <!-- <a href="javascript:void(0)" onClick="getimages({{$li.id}})"  onMouseOut="closenettip({{$li.id}})"><img src="/fuman/images/picture0.png"><span id="newtip_info{{$li.id}}" style="position:absolute; z-index:1"></span></a>-->
     
        </td>
        <td style="position:relative;">{{$li.price}}</td>
        <td valign="middle">{{$li.special_price}}</td>
        <td class="cz">{{$li.weight}}</td>
        <td style="width: 50px; overflow:hidden;white-space:nowrap; text-overflow:ellipsis;">{{$li.including}}</td>
        <td style="width: 50px; overflow:hidden;white-space:nowrap; text-overflow:ellipsis;">{{$li.fabric}}</td>
        <td valign="middle">
        	{{if $li.is_open ==0}}
            	正常销售
            {{/if}}
            {{if $li.is_open ==1}}
            	商品停售[下架]
            {{/if}}
              {{if $li.is_open ==2}}
            	库存设零
            {{/if}}
            
            {{if $li.isupload==1}}
            	<br>等待更新
            {{/if}}
            {{if $li.isupload==3}}
            	<br>已更新到网站
            {{/if}}
        </td>
        <td valign="middle">
        	{{if $li.product_url}}
        		<a href="{{$li.product_url}}" target="_blank">查看</a>
            {{/if}}
            
             {{if $li.isupload==1}}
            	<a href="/magento/ajaxbutton?op=Editproductnext&id={{$li.id}}" target="_blank">编辑</a> | <a href="/magento/ajaxbutton?op=addproductimages&id={{$li.id}}" target="_blank">图片</a>
            {{/if}}
            
             {{if $li.isupload==2}}
          | <a href="/magento/ajaxbutton?op=addproductimages&id={{$li.id}}" target="_blank">重传图片</a>
            {{/if}}
        </td>
       
      </tr>
      {{/foreach}}
        </tbody>
      
    </table>
    <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
  </div>
</div>

<!-- 模态框（Modal）批量标完成 -->
<form action="/magento/ajaxbutton?op=saveupdate"  method="post" name="batchendorderST" id="batchendorderST">
  <div class="modal fade" id="endorderform" tabindex="-1" role="dialog" aria-labelledby="sendorderform" aria-hidden="true">
    <div class="modal-dialog" style="width:98%;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sendorderform"> 待处理商品  </h4>
        </div>
        <div class="modal-body">
          <span id="errshowsku"></span>
           <div style="width:100%;height:400px; overflow-y:scroll; border:0px solid;">
    <table cellpadding="0" cellspacing="0" border="0" class="stdtable" >
      <thead>
        <tr class="lbbt">
          <td  bgcolor="#FEFFF1" style="width:100px">店名</td>
          <td bgcolor="#FEFFF1" style="width:100px">商品编号</td>
          <td  bgcolor="#FEFFF1">商品名称</td>
           <td  bgcolor="#FEFFF1"  >重量KG</td>
          <td  bgcolor="#FEFFF1">价格</td>
          <td  bgcolor="#FEFFF1"  >折扣价</td>
<!--           <td  bgcolor="#FEFFF1">短简介</td>
          <td  bgcolor="#FEFFF1">Meta Title</td>
          <td  bgcolor="#FEFFF1">keywords</td> -->
<!--          <td  bgcolor="#FEFFF1">包含物品</td>
           <td bgcolor="#FEFFF1">质地</td>
-->          <td   bgcolor="#FEFFF1" >状态</td>
            <td  bgcolor="#FEFFF1" >介绍</td>
         
        </tr>
      </thead>
      
      <tbody id="endorderlistst">
          
         
      </tbody>
      
          </table>
           </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="AWSsubmitst('batchendorderST','endorderform')"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
  </form>




<!-- magento 转csv -->
<form  method="post" id="modal_submit" action="#">
        <input type="hidden" name="editid" id="editid">
        <div class="modal fade" id="magentocsv" tabindex="-1" role="dialog" aria-labelledby="magentocsv" aria-hidden="true">
            <div class="modal-dialog" style="width:740px;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">× </button>
                        <h4 class="modal-title" id="sebayauth">在线产品转shopify专用csv</h4>
                    </div>
                    <div class="modal-body">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td align="right">选择网站： </td>
                                <td align="left">
                                      <select name="magentowebname" id="magentowebname">
                                            <option value="">-店铺名-</option>
                                            {{foreach from=$webname item=li key=key}}
                                              <option value="{{$li.webname}}">
                                                  {{$li.webname}}
                                              </option>
                                            {{/foreach}}
                                        </select>
                                    <font color="#FF0000">(*必选项)</font>
                                    </td>
                            </tr>  
                            <tr>
                              <td align="right">说明：</td>
                              <td align="left">例如：选择A网站，则会把当前平台的，A网站的产品导出，转化为shopify专用csv。</td>
                            </tr>                      
                        </table>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default"
                                    data-dismiss="modal"> 关闭 </button>
                            <!--
                            <button type="button" class="btn btn-primary"  onclick="atmangban()">授权</button>-->
                            <button type="button" class="btn btn-primary" onClick="magentocsvok()">确认</button>
                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
        </div>
        <!-- /.modal -->
    </form>













</body>
</html>